package org.bigpigman.el.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description
 * @Author 朱咸军
 * @Date 2019/12/19
 **/
public class LoggerTool {

    private static final Logger log = LoggerFactory.getLogger(LoggerTool.class);

    public static void logExceptionInfo(Exception e) {
        e.printStackTrace();
        log.error("********************异常日志打印开始********************");
        log.error("抛出的异常为:{}", e.getClass());
        StackTraceElement[] traceElements = e.getStackTrace();
        for (StackTraceElement element : traceElements) {
            log.error("发生异常类名:{},发生异常方法名:{},发生异常行数:{}",
                    element.getClassName(), element.getMethodName(), element.getLineNumber());
        }
        log.error("********************异常日志打印结束********************");
    }

}
